using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Text;
using DAL;
using Entities;
/// <summary>
/// Summary description for tbChiTietDHBUS
/// </summary>
public class tbChiTietDHBUS
{
    public static void Insert_ChiTietDH(tbChiTietDH chitietdh)
    {
        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        chitietdhDAL.Insert(chitietdh);
    }
    public static void Update_ChiTietDH(tbChiTietDH chitietdh)
    {
        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        chitietdhDAL.Update(chitietdh);
    }
    public static void Delete_ChiTietDH(int Id)
    {
        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        chitietdhDAL.Delete(Id);
    }
    public static tbChiTietDH.tbChiTietDHCollection Get(string Where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
    {

        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        return (chitietdhDAL.Get(Where, pageindex, pagesize, orderby, orderdirection, out total));
    }
    public static tbChiTietDH.tbChiTietDHCollection GetAll()
    {
        int total = 0;
        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        return chitietdhDAL.Get("Where 1=1", 0, 0, tbChiTietDH.tbChiTietDHColumns.IDCTDH.ToString(), "ASC", out total);
    }
    public static tbChiTietDH GetByID(int iD)
    {
        int total = 0;
        tbCTDonHangDAL chitietdhDAL = new tbCTDonHangDAL();
        tbChiTietDH.tbChiTietDHCollection chitietdhcollection = chitietdhDAL.Get("where " + tbChiTietDH.tbChiTietDHColumns.IDCTDH.ToString() + "=" + iD.ToString(), 0, 0, tbChiTietDH.tbChiTietDHColumns.IDCTDH.ToString(), "ASC", out total);
        if (chitietdhcollection.Count > 0)
            return chitietdhcollection[0];
        return null;
    }
}
